# 单双链表
class linkList:
	def __init__(self,data):
		self.data = data
		self.next = None
		self.pre = None

# 头插法
def create_link_head(li):
	head = linkList(li[0])
	for i in li[1:]:
		node = linkList(i)
		node.next = head
		head.pre = node  # 双链表
		head = node
	return head

# 尾插法
def create_link_tail(li):
	head = linkList(li[0])
	tail = head
	for i in li[1:]:
		node = linkList(i)
		tail.next = node
		node.pre = tail # 双链表
		tail = node
	return head

def show_dead(head):
	print(head.data,end=',')
	while head.next:
		print(head.next.data,end=',')
		head = head.next
	print()

curnode = linkList(1.5)
# head = create_link_tail([1,2,3,4,5,6,7])
# 单链表删除第二个元素
# head.next = head.next.next
# show_dead(head)
# 双链表删除第二个元素
# head.next.next.pre = head
# head.next = head.next.next
# show_dead(head)

# 单链表添加到第二个元素
# curnode.next = head.next
# head.next = curnode
# show_dead(head)

# 双链表添加到第二个元素
# curnode.next = head.next
# head.next.pre = curnode
# curnode.pre = head
# head.next = curnode
# show_dead(head)